import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Home',
    component: () => import(/* webpackChunkName: "home" */ '../views/Home.vue'),
    children: [
      {
        name: 'user',
        path: 'user',
        component: () => import(/* webpackChunkName: "user" */ '../views/user/user.vue'),
      },
      {
        name: 'role',
        path: 'role',
        component: () => import(/* webpackChunkName: "user" */ '../views/user/role.vue'),
      },
      {
        name: 'rights',
        path: 'rights',
        component: () => import(/* webpackChunkName: "user" */ '../views/user/rights.vue'),
      },
      {
        name: 'overview',
        path: 'overview',
        component: () => import(/* webpackChunkName: "stat" */ '../views/stat/overview.vue'),
      },
      {
        name: 'error',
        path: 'error',
        component: () => import(/* webpackChunkName: "stat" */ '../views/stat/error.vue'),
      },
      {
        name: 'behave',
        path: 'behave',
        component: () => import(/* webpackChunkName: "stat" */ '../views/stat/behave.vue'),
      },
      {
        name: 'performance',
        path: 'performance',
        component: () => import(/* webpackChunkName: "stat" */ '../views/stat/performance.vue'),
      },
      {
        name: 'Test',
        path: 'test',
        component: () => import(/* webpackChunkName: "user" */ '../views/test.vue'),
      },
      {
        path: '*',
        redirect: 'user'
      }
    ]
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import(/* webpackChunkName: "login" */ '../views/Login.vue')
  },
  {
    path: '*',
    redirect: '/user'
  },
]

const router = new VueRouter({
  routes
})

export default router
